﻿using System;
using System.Drawing;

namespace Segmentation.Business
{
    public class JImage
    {
        #region Fields

        private float[,] jData;
        private int step;
        private int tr;

        #endregion Fields

        #region Constructors

        public JImage(int step, int TR, float[] data, int height, int width)
        {
            this.step = step;
            this.tr = TR;

            this.jData = new float[height, width];

            for (int y = 0, i = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    this.jData[y, x] = data[i++];
                }
            }
        }

        #endregion Constructors

        #region Properties

        public int Step
        {
            get
            {
                return this.step;
            }
        }

        public int TR
        {
            get
            {
                return this.tr;
            }
        }

        public float[,] JData
        {
            get
            {
                return this.jData;
            }
        }

        #endregion Properties

        #region Methods

        public override string ToString()
        {
            if (this.step > 100)
            {
                return string.Format("Step{0}_TR{1}", this.step - 100, this.tr.ToString("00"));
            }
            else
            {
                return string.Format("Step{0}_TR{1}G", this.step, this.tr.ToString("00"));
            }
        }

        #endregion Methods
    }
}
